import { reqUserAddressList, reqOrderInfo } from "@/api";


const actions = {
    //获取用户地址信息
    async userAddressList({ commit }) {
        let result = await reqUserAddressList();
        if (result.code == 200) {
            commit("USERADDRESSLIST", result.data);
            return "ok";
        }
    },
    //获取商品清单数据
    async getOrderInfo({ commit }) {
        let result = await reqOrderInfo();
        if (result.code == 200) {
            commit("GETORDERINFO", result.data);
            return "ok";
        }
    }

};
const mutations = {
    USERADDRESSLIST(state, userAddressList) {
        state.userAddressList = userAddressList;
    },
    GETORDERINFO(state, orderInfo) {
        state.orderInfo = orderInfo;
    }
}
const state = {
    userAddressList: [],
    orderInfo: {}
}
const getters = {}


export default {
    namespaced: true,
    actions,
    mutations,
    state,
    getters
}